﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Globalization;
using System.Web.Security;

namespace MsForgeReboot.Web.Models { 
    public class UsersContext : DbContext {
        public UsersContext()
            : base("DefaultConnection") {
        }

        public UsersContext(string connstr) : base(connstr) {}

        public DbSet<UserProfile> UserProfiles { get; set; }
    }

    [Table("UserProfile")]
    public class UserProfile {
        [Key]
        [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
        public int UserId { get; set; }
        public string UserName { get; set; }
    }

    public class RegisterExternalLoginModel {
        [Required]
        [Display(Name = "Participants name")]
        public string UserName { get; set; }

        public string ExternalLoginData { get; set; }

        [Display(Name="Puno ime")]
        public string PublicName { get; set; }

    }

    public class LocalPasswordProfileModel {
        [DataType(DataType.Password)]
        [Display(Name = "Trenutna lozinka")]
        public string OldPassword { get; set; }

        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "Nova lozinka")]
        public string NewPassword { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "Potvrdite novu lozinku")]
        [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
        public string ConfirmPassword { get; set; }

        [Required(AllowEmptyStrings=false)]
        [DataType(DataType.EmailAddress)]
        [Display(Name="Korisničko ime (u obliku e-mail adrese)")]
        public string UserName { get; set; }

        public string PublicName { get; set; }
        public bool Notifications { get; set; }
        
    }

    public class LoginModel {
        [Required]
        [Display(Name = "Korisnicko ime")]
        public string UserName { get; set; }

        [Required]
        [DataType(DataType.Password)]
        [Display(Name = "Lozinka")]
        public string Password { get; set; }

        [Display(Name = "Zapamti me?")]
        public bool RememberMe { get; set; }
    }

    public class RegisterModel {
        [Required(AllowEmptyStrings=false)]
        [DataType(DataType.EmailAddress,ErrorMessage="Nije uneta validna e-mail adresa.")]
        [Display(Name = "E-mail adresa")]
        public string UserName { get; set; }

        [Required]
        [StringLength(100, ErrorMessage = "{0} mora biti dužine najmanje {2} karaktera.", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "Lozinka")]
        public string Password { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "Potvrdi lozinku")]
        [Compare("Password", ErrorMessage = "Lozinke se ne poklapaju.")]
        public string ConfirmPassword { get; set; }

        [Required(AllowEmptyStrings=false)]
        [Display(Name="Ime")]
        public string PublicName { get; set; }

        [Required]
        [Display(Name="Želim da primam notifikacije")]
        public bool Notifications { get; set; }
    }

    public class ExternalLogin {
        public string Provider { get; set; }
        public string ProviderDisplayName { get; set; }
        public string ProviderUserId { get; set; }
    }

    public class ProfileModel {
    }
}
